package com.neusoft.chatserver.controller;


import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.neusoft.chatserver.dto.RespBean;
import com.neusoft.chatserver.entity.UserFriend;
import com.neusoft.chatserver.service.IUserFriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liuxp
 * @since 2021-07-14
 */
@CrossOrigin
@RestController
@RequestMapping("/chat")
public class UserFriendController {
    @Autowired
    IUserFriendService iUserFriendService;

    @PostMapping("/addFriend")
    RespBean addFriend(@RequestBody UserFriend userFriend){
        return iUserFriendService.addFriend(userFriend);
    }

    @PostMapping("/deleteFriend")
    RespBean deleteFriend(@RequestBody UserFriend userFriend){
        return iUserFriendService.deleteFriend (userFriend);
    }

    @PostMapping("/getAllFriend/{userId}")
    RespBean getAllFriend(@PathVariable Integer userId){
        return iUserFriendService.getAllFriend(userId);
    }
}

